//This package provide some wrapper for Stuff Model to deal with MongoDB using mgo driver
package mongodb-wrapper

import (
	"launchpad.net/mgo"
	"launchpad.net/mgo/bson"
)

type Server struct {
	Host string
	User string
	Pass string
	Sess *mgo.Session
	DB *mgo.Database
}

func (s *Server) Table(name string) *mgo.Collection {
	t = new(Table)
	t.c = s.DB.C(name)
	return t
}

type Table struct {
	c *mgo.Collection
}

func (t *Table) Insert(data interface{}) error {
	err := c.Insert(data)
	return err
}

func (t *Table) Update(id string, value *map[string]interface{}) error {
	err = c.Update(bson.M{"_id": id, bson.M(*value))
}
